/**
 * Created by xiebang
 * Description
 * User:小谢
 * Date:2021-08-04
 * Time:9:04
 */
public class TestDemo {


    public static void main(String[] args) {
        myArraySeqList myArraySeqList = new myArraySeqList();
        myArraySeqList.add(0,1);
        myArraySeqList.add(1,2);
        myArraySeqList.add(2,3);
        myArraySeqList.add(3,4);
        myArraySeqList.add(4,5);
        myArraySeqList.add(5,6);

        //检测元素是否添加成功，顺便检测打印方法是否正确
        myArraySeqList.display();
        //检测判断是否包含方法
        System.out.println(myArraySeqList.contains(1));
        System.out.println(myArraySeqList.contains(10));
        //检测查找某个元素的位置的方法
        System.out.println(myArraySeqList.search(2));
        System.out.println(myArraySeqList.search(9));
        //检测获取pos位置元素的方法
        System.out.println(myArraySeqList.getPos(1));
        System.out.println(myArraySeqList.getPos(9));
        //检测将pos位置的值设为value的方法
        myArraySeqList.setPos(2,7);
        myArraySeqList.setPos(7,8);
        myArraySeqList.display();
        //检测删除第一次出现的元素的方法
        myArraySeqList.remove(1);
        myArraySeqList.remove(9);
        myArraySeqList.display();
        //检测获取顺序表的长度的方法
        System.out.println(myArraySeqList.getSize());
        //检测清空顺序表的方法
        myArraySeqList.clear();
        myArraySeqList.display();
    }

    //顺序表  底层是一个数组
    //逻辑上个物理上都是连续的
    //静态顺序表；
    //动态顺序表
    //给定关键字:o(n)
    //给定下标：o(1)
    //改：o(1j)
    public static void main1(String[] args) {
        MyArrayList myArrayList = new MyArrayList();
        myArrayList.add(0,1);
        myArrayList.add(1,2);
        myArrayList.add(2,3);
        myArrayList.add(3,4);
        myArrayList.add(4,5);
        myArrayList.add(5,6);
        myArrayList.display();
        myArrayList.remove(2);
        myArrayList.display();
    }
}
